<?xml version="1.0" encoding="ISO-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<title>Cadastro de Paciente</title>
</head>

<body>
	<ui:composition template="/WEB-INF/template/templateMaster.xhtml">
		<ui:define name="conteudo">
			<h1>Cadastramento de Paciente</h1>
			<h:form id="cadastro">
			<p:growl id="growl" showDetail="true"/>  
  

			
				<h:inputHidden value="#{pacienteBean.paciente.idPaciente}" />

				<h:panelGrid columns="2">
					
					<h:outputLabel value="Nome: " for="nome" />
					<p:inputText id="nome"
						value="#{pacienteBean.paciente.nome}" size="45" required="true"
						requiredMessage="Digite o nome"
						validatorMessage="O nome deve possuir de 5 a 45 caracteres.">
						<f:validateLength minimum="5" maximum="45" />
					</p:inputText>
					<h:outputLabel value="Data de Nascimento:" for="data"/>
					<p:calendar value="#{pacienteBean.paciente.dataNascimento}"
						id="data" required="true" />

					<h:outputLabel value="CPF: " for="cpf" />
					<p:inputMask id="cpf" value="#{pacienteBean.paciente.cpf}"
						mask="999.999.999-99" required="true"
						requiredMessage="Dgite o CPF">
						<f:converter converterId="converter.CpfConverter" />
						<f:validator validatorId="validator.CpfValidator" />
					</p:inputMask>

					<h:outputLabel value="RG: " for="rg" />
					<p:inputMask id="rg" value="#{pacienteBean.paciente.rg}"
						mask="99.999.999-9" required="true" requiredMessage="Digite o RG" />

					<h:outputLabel value="Telefone: " for="telefone" />
					<p:inputMask id="telefone"
						value="#{pacienteBean.paciente.telefone}" mask="(99) 9999-9999" />				
						
					

					<h:outputLabel value="Sexo: " for="sexo" />
					<h:selectOneMenu id="sexo" value="#{pacienteBean.paciente.sexo}">
						<f:selectItems value="#{pacienteBean.listSexoPaciente}" />
					</h:selectOneMenu>
					
					<h:outputLabel value="Foto: " for="photos" />


        <p:photoCam widgetVar="pc" listener="#{pacienteBean.oncapture}" update="photo"/>  
  
        <p:commandButton type="button" value="Capturar" onclick="pc.capture()"/>  
          
  
        <p:graphicImage value="/foto.png"  id="photo"/>

				</h:panelGrid>
				


<br/>
				<h:commandButton action="#{pacienteBean.salvar}" value="Salvar"/>

			</h:form>
		</ui:define>
	</ui:composition>
</body>
</html>